package com.ruoyi.wx.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wx.mapper.OrdersdetailMapper;
import com.ruoyi.wx.domain.Ordersdetail;
import com.ruoyi.wx.service.IOrdersdetailService;

/**
 * 订单详情Service业务层处理
 *
 * @author hxie
 * @date 2020-12-24
 */
@Service
public class OrdersdetailServiceImpl implements IOrdersdetailService
{
    @Autowired
    private OrdersdetailMapper ordersdetailMapper;

    /**
     * 查询订单详情
     *
     * @param detailid 订单详情ID
     * @return 订单详情
     */
    @Override
    public Ordersdetail selectOrdersdetailById(String detailid)
    {
        return ordersdetailMapper.selectOrdersdetailById(detailid);
    }

    /**
     * 查询订单详情列表
     *
     * @param ordersdetail 订单详情
     * @return 订单详情
     */
    @Override
    public List<Ordersdetail> selectOrdersdetailList(Ordersdetail ordersdetail)
    {
        return ordersdetailMapper.selectOrdersdetailList(ordersdetail);
    }

    /**
     * 新增订单详情
     *
     * @param ordersdetail 订单详情
     * @return 结果
     */
    @Override
    public int insertOrdersdetail(Ordersdetail ordersdetail)
    {
        ordersdetail.setCreateTime(DateUtils.getNowDate());
        return ordersdetailMapper.insertOrdersdetail(ordersdetail);
    }

    /**
     * 修改订单详情
     *
     * @param ordersdetail 订单详情
     * @return 结果
     */
    @Override
    public int updateOrdersdetail(Ordersdetail ordersdetail)
    {
        ordersdetail.setUpdateTime(DateUtils.getNowDate());
        return ordersdetailMapper.updateOrdersdetail(ordersdetail);
    }

    /**
     * 批量删除订单详情
     *
     * @param detailids 需要删除的订单详情ID
     * @return 结果
     */
    @Override
    public int deleteOrdersdetailByIds(String[] detailids)
    {
        return ordersdetailMapper.deleteOrdersdetailByIds(detailids);
    }

    /**
     * 删除订单详情信息
     *
     * @param detailid 订单详情ID
     * @return 结果
     */
    @Override
    public int deleteOrdersdetailById(String detailid)
    {
        return ordersdetailMapper.deleteOrdersdetailById(detailid);
    }

    /**
     * 根据ordersId查询
     */
    @Override
    public List<Ordersdetail> selectByordersId(String ordersId){
        return ordersdetailMapper.selectByordersId(ordersId);
    }
}
